perf: 경매장 거래 내역 검색 아이템명 완전 일치 여부 요청 파리미터 추가 및 인덱스 개선#101
Conversation
✅ 테스트 결과 for PRBuild: success 🧪 테스트 실행 with Gradle |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR enhances auction history and realtime search functionality by adding an exact item name matching option and optimizing database indexes for better query performance.
Changes:
- Added
isExactItemNameparameter to enable exact vs partial (LIKE) item name matching - Optimized auction history indexes by replacing
idx_top_sub_itemwithidx_ah_top_sub_name_dateand addingidx_ahio_type_history - Updated date examples in API documentation to reflect current dates
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| AuctionHistorySearchRequest.java | Added isExactItemName Boolean parameter for exact match option |
| AuctionRealtimeSearchRequest.java | Added isExactItemName Boolean parameter for exact match option |
| AuctionHistoryQueryDslRepository.java | Implemented conditional logic for exact vs LIKE search based on new parameter |
| AuctionRealtimeQueryDslRepository.java | Implemented conditional logic for exact vs LIKE search based on new parameter |
| V20__optimize_auction_history_search_indexes.sql | Replaced legacy index with optimized multi-column indexes |
| DateAuctionBuyRequest.java | Updated example dates to February 2026 |
| AuctionHistoryServiceTest.java | Updated test to include new parameter in record construction |
| ItemInfoServiceTest.java | Code formatting improvements (line break adjustments) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| -- Equality filters first, range/sort column last | ||
| -- date_auction_buy는 where 조건에 무조건 포함 및 높은 확률로 정렬 조건 | ||
| CREATE INDEX idx_ah_top_sub_name_date | ||
| ON auction_history (item_top_category, item_sub_category, item_name, date_auction_buy DESC); |
There was a problem hiding this comment.
The index includes item_name as an equality filter column, but the query logic uses containsIgnoreCase (LIKE search) when isExactItemName is false or null. This means the index may not be effective for the common case of LIKE searches.
Consider either:
- Creating separate indexes for exact vs LIKE searches
- Moving
item_nameafterdate_auction_buyin the index so it doesn't break the index effectiveness for range/sort operations - Adding a covering index without
item_namefor LIKE searches
The current index will only be fully effective when isExactItemName=true, but may have reduced effectiveness for LIKE searches since MySQL/PostgreSQL cannot use the full index when a prefix column uses LIKE patterns.
| ON auction_history (item_top_category, item_sub_category, item_name, date_auction_buy DESC); | |
| ON auction_history (item_top_category, item_sub_category, date_auction_buy DESC, item_name); |
| if (Boolean.TRUE.equals(c.isExactItemName())) { | ||
| builder.and(ah.itemName.eq(c.itemName())); | ||
| } else { | ||
| builder.and(ah.itemName.containsIgnoreCase(c.itemName())); | ||
| } |
There was a problem hiding this comment.
The new isExactItemName parameter lacks test coverage. While the test correctly adds a seventh null parameter to match the new record signature, there are no tests verifying the behavior when isExactItemName is true vs false vs null.
Consider adding test cases that verify:
- When
isExactItemName=true, only exact matches are returned - When
isExactItemName=falseor null, partial matches (LIKE) are returned - The query correctly handles the parameter in combination with other search criteria
| if (Boolean.TRUE.equals(c.isExactItemName())) { | ||
| builder.and(ar.itemName.eq(c.itemName())); | ||
| } else { | ||
| builder.and(ar.itemName.containsIgnoreCase(c.itemName())); | ||
| } |
There was a problem hiding this comment.
The new isExactItemName parameter lacks test coverage. There are no tests verifying the behavior when isExactItemName is true vs false vs null.
Consider adding test cases that verify:
- When
isExactItemName=true, only exact matches are returned - When
isExactItemName=falseor null, partial matches (LIKE) are returned - The query correctly handles the parameter in combination with other search criteria
📋 상세 설명
auction_history테이블에 기존 인덱스 제거📊 체크리스트